// NumHotEdit.cpp : implementation file
//

#include "stdafx.h"
#include "finance.h"
#include "NumHotEdit.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNumHotEdit

CNumHotEdit::CNumHotEdit()
{
}

CNumHotEdit::~CNumHotEdit()
{
}


BEGIN_MESSAGE_MAP(CNumHotEdit, CHotEdit)
	//{{AFX_MSG_MAP(CNumHotEdit)
	ON_WM_CHAR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNumHotEdit message handlers

// 
// 
//--------------------------------------------------------------
void CNumHotEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	CString	csTmp;
						//  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 
	BYTE	retTab[129] = { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
							0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 16 ~ 31
							0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,  // 32 ~ 47
							1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  // 48 ~ 63
							0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 64 ~ 79
							0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 80 ~ 95
							0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 96 ~ 111
							0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  //112 ~ 127
							0												 //128
						};

	if( (nChar >= 128) || (nChar < 0) )
		return ;
	
	if( !retTab[nChar] )
		return ;

	// check the decimal point character
	if( 46 == nChar )
	{
		GetWindowText( csTmp );
		if( csTmp.Find('.') > -1  ) 
			return ;
	}
		

	CHotEdit::OnChar(nChar, nRepCnt, nFlags);
}
